$(function() {
	platformId = "";// 当前页面所使用的平台id
	getPlatformId();// 
});

function getPlatformId() {// 从测试序列界面的链接路径中截取ID
	var url = location.search; // 获取url中"?"符后的字串
	path = location.host;
	if (url.indexOf("?") != -1) {
		var str = url.substr(1);
		strs = str.split("&");
		platformId = strs[3].split("=")[1];
	}
}

tests=function(moudle){ 
	if(moudle=="start"){//点击的是开始和终止按钮
		console.log("开始测试");
		ajaxSendLaisInfo(1);
	}else if(moudle=="stop"){
		console.log("停止测试");
		ajaxSendLaisInfo(2);
	}
 };
 
function ajaxSendLaisInfo(sendSignal) {//外围设备信息发送功能
	addLoading();
	$.ajax({
		"url" : "../../../lais/ajaxSendLaisSignal",
		"type" : "post",
		"data" : {
			"sendSignal" : sendSignal,
			"platformId" : platformId
		},
		"success" : function(result) {
			removeLoading();
			if (result.flag == 0) {
				console.log(result);
				if(result.content){
					$("#linkStatus").css("background","green");
				}else{
					$("#linkStatus").css("background","red");
				}
				book('发送成功！');
			} else {
				$("#linkStatus").css("background","red");
				var content=result.errorInfo;
				book(content);
			}
		},
		"error" : function() {
			removeLoading();
			var content="手工测试连接错误！";
			book(content);
		}
	});
}
